import logging
import os
import sys

from dotenv import load_dotenv, find_dotenv

logging.basicConfig(stream=sys.stdout, level=logging.INFO)
logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))

# 加载本地 .env 配置文件
_ = load_dotenv(find_dotenv(), override=True)
HF_ENDPOINT = os.getenv("HF_ENDPOINT")
LLM_CACH_DIR = os.getenv("LLM_CACH_DIR")

PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

NLTK_DATA = os.environ.get(
    "NLTK_DATA",
    os.path.join(
        PROJECT_DIR,
        "_static/nltk_cache",
    ),
)

STORE_FILE = os.path.join(PROJECT_DIR, "data", "docstore.json")

if __name__ == "__main__":
    print(f"PROJECT_DIR:{PROJECT_DIR}")
    print(STORE_FILE)
    print(NLTK_DATA)
    print(HF_ENDPOINT)
    file = os.path.abspath(__file__)
    print(f"file:{file} dir2:{os.path.dirname(os.path.dirname(file))}")
